import ArticleService from '../service'
import jwt from 'jsonwebtoken'

class ArticleController {
    static async tag(ctx) {
        let {
            password,
            username
        } = ctx.request.body;
        ctx.body = {
            code: 200,
            msg: 'success',
            data: [
                { a: 1 },
                { b: 1 },
                { c: 1 },
                { d: 1 },
            ]
        }
    }

    static async list(ctx) {
        let {
            password,
            username
        } = ctx.request.body;
        // 测试获取token载荷信息
        console.log(jwt.decode(ctx.request.header.authorization.split(' ').pop()));
        ctx.body = await ArticleService.list()
    }
}

export default ArticleController;